package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.New;
import cn.wolfcode.trip.base.query.NewQueryObject;
import cn.wolfcode.trip.base.service.INewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

//所有头条资源的控制器
@RestController
@RequestMapping("/smallerNews")
public class SmallNewController {
    @Autowired
    private INewService newService;
    /**
     * 查询所有的日报信息
     * @param qo
     * @return
     */
    @GetMapping
    public Object getCommend(NewQueryObject qo ) {
        qo.setOrderBy("releaseTime desc");
        qo.setPageSize(10);
        //去除索引为0那条信息
        List<New> list = newService.query(qo).getList();
        list.remove(0);
        return list;
    }
}
